package BizLogic;

import dao.DAOFactory;
import dao.PriorityDAO;

import java.sql.SQLException;
import java.util.ArrayList;

import model.Priority;
public class PriorityManager {
	
	private PriorityDAO priorityDAO;
	public PriorityManager(){
		 priorityDAO=DAOFactory.loadInstance().getPriorityDAO();
	}
	Priority priority=new Priority();
	
	public ArrayList<String> getPriorities()
	{
		ArrayList<String> Priority=priorityDAO.findAllPriorityNames();
		return Priority;
	}
	public ArrayList<Priority> getAllPriority(){
		   ArrayList<Priority> priority=null;
			try {
				priority = priorityDAO.findAllPriority();
			} catch (SQLException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
		return priority;
	}
	
	public void addPriority(String pri){
		priority.setPriorityType(pri);		
		try {
			priorityDAO.insertPriority(priority);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
